#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<unistd.h>
#include"process.h"

double total = 2048.0;
double once = 0.1;

//2024.10.13

void download()
{
    double current = 0.0;
    while(current<total)
    {
        int r = rand()%10+1;//[1-10]
        double speed = r*once;
        current+=speed;
        if(current>=total)
        {
            current = total;
        }
        //根据实际情况来更新进度条
        process1(total,current);
        //更新速度
        //printf("test: %lf/%lf\r",current,total);
        //fflush(stdout);
        usleep(100000);
    }
    printf("\n");
}

int main()
{
    srand(time(NULL));
    download();
    //process();
    return 0; 
}
